﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="aspnet_Applicationsform.aspx.cs" Inherits="form_usermanagement_aspnet_Applicationsform" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Role Form</title>
    <link href="<%= ResolveClientUrl("~/css/jquery.validate.error.css") %>" rel="stylesheet"
        type="text/css" />
    <script src="<%= ResolveClientUrl("~/script/helper.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveClientUrl("~/script/jquery.validate.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveClientUrl("~/script/jquery.validate.wrapper.js") %>" type="text/javascript"></script>
    <script type="text/javascript">

        $(document).ready(function () {

            //            // 1. prepare the validation rules and messages.
            //            var rules = {
            //                txtDesc: {
            //                    required: true,
            //                    maxlength: 50
            //                }

            //            };
            //            var messages = {
            //                txtDesc: {
            //                    required: "Role Name is required",
            //                    maxlength: "Maximum length of menu name is 50"
            //                }

            //            };

            //            // 2. Initiate the validator
            //            var validator = new jQueryValidatorWrapper("form1", rules, messages);

            //            if (!validator.validate()) {
            //                $('#form1').trigger('submit'); // Call Submit when first page is loaded and form is invalid
            //            }

            // 3. Set the click event to do the validation
            $("#save").click(function () {

                //                if (!validator.validate())
                //                    return;

                var handlerUrl = '<%= ResolveClientUrl("~/ajaxhandler/stp_config.ashx") %>';

                var configname = $('#txtConfigName').val();
                var configvalue = $('#txtConfigValue').val();

                var id = $('#<%= hfID.ClientID %>').val();

                var param = '&configname=' + configname + '&configvalue=' + configvalue;

                if (id == 0)
                    CallAjax(handlerUrl, "?method=insert&" + param);
                else
                    CallAjax(handlerUrl, "?method=update&" + param + "&id=" + id);

                parent.$('#dialog').dialog("close");

                setTimeout("parent.$('#table').trigger('reloadGrid');", 3000);



                return false;
            });


        });
    
    </script>
    <script type="text/javascript">

        function ClearText() {

            $('#txtDesc').val('');

        }



        $('#close').click(function () {
            parent.$('#dialog').dialog("close");
        });

         
    </script>
</head>
<body onload="ClearText();">
    <form id="form1" runat="server">
    <table border="0">
        <tr>
            <td style="width: 50">
                Application Name
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtApplicationName" runat="server" Width="300"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td style="width: 50">
                Lowered Application
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtLowered" runat="server" Width="300"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td style="width: 50">
                Description
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="TextBox1" runat="server" Width="300"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <div style="text-align: right; padding-top: 10px;">
                    <a href="#" id="save" class="dialog_link ui-state-default ui-corner-all" alt="Save">
                        <span class="ui-icon ui-icon-disk"></span>Save</a> <a href="#" id="close" class="dialog_link ui-state-default ui-corner-all"
                            alt="Close" onclick="parent.$('#dialog').dialog('close');"><span class="ui-icon ui-icon-close">
                            </span>Close</a>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <asp:HiddenField ID="hfID" runat="server" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
